#!/usr/bin/env python3

def getcycle(n, d,ret):
    divs = set()
    num = n
    den = d
    digit = 0
    rem = 0
    answer = "0."
    x = 0
    while True:
        x += 1
#        print(str(x)+"-----")
#        print(str(num)+"/"+str(den))
#        print(digit)
        #add div to seq
        divs.add((num,den))
        while num < den:
            num *= 10
            answer += "0"
        if num == den:
            return 0
        digit = num // den
        rem = num % den
        if rem == 0:
            return 0
        num = rem
        answer += str(digit)
        if (num,den) in divs:
            if ret == 1:
                return x
            else:
                return getcycle(num,den,1)
                
answer = 0
num = 0

for x in range(2,1001):            
    c = getcycle(1,x,0)
    if c > answer:
        answer = c
        num = x
        
print("1/"+str(num)+" = "+str(1/num))
print("Cycle: "+str(answer))